package com.xwj.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.tomcat.util.net.openssl.ciphers.Authentication;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 获取登录用户信息接口
 *
 * @author xwj
 * @date 2020/10/21
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @PostMapping("/getCurrentUser")
    public Object getCurrentUser(Authentication authentication, HttpServletRequest request) {
        String header = request.getHeader("user");
        JSONObject result = JSON.parseObject(header);
        return result;
    }
}
